<?php 
    $page_name      = $this->page_name;
    $object_name    = $this->object_name;
    $user_name      = $this->user_name;
    $date_time      = $this->date_time;
    $campaign_url   = $this->campaign_url;
    $order_info     = $this->order_info;
    $order_details  = $this->order_details;
    $store          = $this->store;
?>
<div style="background-color: #f4f4f4; padding: 20px; width: 610px;">
    <div style="border: 1px solid #cfcfcf; box-shadow: 0 0 6px #AAAAAA; background-color: #ffffff;">
        <h1 style="border-bottom: 1px solid #eeeeee; border-top: 10px solid #8d91af; margin: 0; padding: 20px 30px; color: #313131;">
            <?php echo $this->escape($page_name) . ' | ' . $this->escape($object_name); ?>
        </h1>
        <h2 style="margin: 0; padding: 20px 30px; color: #313131; font-weight: normal;">
            <?php echo "Order number: #" . $this->escape($order_info->id);?>
        </h2>
        <table style="margin-left: 30px; line-height: 22px; border-collapse: collapse;">
            <tr>
                <td style="text-align: right; width: 92px; vertical-align: top;"><label style="margin-right: 20px;">Name</label></td>
                <td style="width: 448px;">
                    <?php if(!empty($order_info->link)):?>
                        <a target="_blank" href="<?php echo $this->escape($order_info->link);?>"><?php echo $this->escape($order_info->user_name);?></a>
                    <?php else:?>
                        <span><?php echo $this->escape($order_info->user_name);?></span>
                    <?php endif;?>
                </td>
            </tr>
            <tr>
                <td style="text-align: right; width: 92px; vertical-align: top;"><label style="margin-right: 20px;">Email</label></td>
                <td style="width: 448px;">
                    <span><?php echo $this->escape($order_info->user_email);?></span>
                </td>
            </tr>
            <tr>
                <td style="text-align: right; width: 92px; vertical-align: top;"><label style="margin-right: 20px;">Phone</label></td>
                <td style="width: 448px;">
                    <span><?php echo $this->escape($order_info->user_phone);?></span>
                </td>
            </tr>
            <tr>
                <td style="text-align: right; width: 92px; vertical-align: top;"><label style="margin-right: 20px;">Address</label></td>
                <td style="width: 448px;">
                    <span><?php echo $this->escape($order_info->user_location);?></span>
                </td>
            </tr>
            <tr>
                <td style="text-align: right; width: 92px; vertical-align: top;"><label style="margin-right: 20px;">Date</label></td>
                <td style="width: 448px;">
                    <span><?php echo date("m-d-Y", $order_info->time_sent);?></span>
                </td>
            </tr>
        </table>
        <br>

        <table style="margin-left: 30px; border-spacing: 0; border-collapse: collapse; width: 540px;">
            <thead style="line-height: 32px;background-color: #F0F0F0;border-bottom: 1px solid #CECECE;">
                <tr>
                    <th>
                        <span style="text-align: left; width: 240px; padding: 0 5px; display: inline-block;">Product</span>
                    </th>
                    <th>
                        <span style="text-align: right; width: 120px; padding: 0 5px; display: inline-block;">Qty</span>
                    </th>
                    <th>
                        <span style="text-align: right; width: 150px; padding: 0 5px; display: inline-block;">Total</span>
                    </th>
                </tr>
            </thead>
            <tbody>
                <?php
                    $total = 0;
                    foreach ($order_details as $key => $product):		
                        if($product->cart_price != null):
                            $total += $product->cart_price * $product->quantity;
                        endif;
                ?>
                <tr style="border-bottom: 1px solid #CECECE; background-color: #ffffff;">
                    <td style="padding: 10px 5px; color: #414141;">
                        <div style="display: inline-block; float: left;">
                            <a target="_blank" href="<?php echo $this->social->pageUrl(array('redirect_url' => $this->view->pageUrl(array('target' => 'detail','id' => $product['id_store'], 'id_product' => $product['id'])))); ?>">
                                <img style="max-height: 64px; max-width: 64px;" alt="thumbnail" src="<?php echo UPLOAD_URL . '/product/thumbnail/' . $product->image;?>">
                            </a>
                        </div>
                        <div style="display: inline-block; width: 168px; margin-left: 8px;">
                            <p style="margin: 4px 0; line-height: 18px; max-height: 36px;display: block; overflow: hidden;">
                                <a target="_blank" href="<?php echo $this->social->pageUrl(array('redirect_url' => $this->view->pageUrl(array('target' => 'detail','id' => $product['id_store'], 'id_product' => $product['id'])))); ?>">
                                    <?php echo $this->escape($product['name']) ?>
                                </a>
                            </p>
                            <?php if(!empty($product['sku'])):?>
                            <p style="margin: 4px 0">
                                <label>SKU :</label>
                                <span><?php echo $this->escape($product['sku']);?></span>
                            </p>
                            <?php endif; ?>
                            <p style="margin: 4px 0; color: #E89B24;">
                                <?php if($product->cart_price != null):?>
                                <span>
                                    <?php echo Core_Util::formatPrice($store->unit_code, $product->cart_price);?>
                                </span>
                                <span><?php echo $store->getCurrency()?></span>
                                <?php else:?>
                                    <span><?php echo "N/A"?></span>
                                <?php endif;?>
                            </p>
                        </div>
                    </td>
                    <td>
                        <p style="text-align: right; margin: 0;">
                            <span><?php echo $product['quantity']; ?></span>
                        </p>
                    </td>
                    <td>            
                        <p style="text-align: right; margin: 0;">
                            <?php if($product->cart_price != null):?>
                                <span>
                                    <?php echo Core_Util::formatPrice($store->unit_code, $product->cart_price * $product->quantity);?>
                                </span>
                                <span><?php echo $store->getCurrency()?></span>
                            <?php else:?>
                                <span><?php echo "N/A"?></span>
                            <?php endif;?>
                        </p>
                    </td>
                </tr>
                <?php 
                    endforeach;
                ?>
                <tr style="line-height: 32px;background-color: #F0F0F0;">
                    <td colspan="2" style="text-align: right;">
                        <strong><span>Total</span></strong>
                    </td>
                    <td style="text-align: right;">
                        <strong>
                            <span>
                                <?php echo Core_Util::formatPrice($store->unit_code, $total);?>
                            </span>
                            <span><?php echo $store->getCurrency()?></span>
                        </strong>
                    </td>
                </tr>
            </tbody>
        </table>
        <br>
        <?php if(!empty($order_info->user_note)):?>
            <table style="margin: 0px 30px; border-collapse: collapse;">
                <tr>
                    <td style="text-align: right; width: 92px; vertical-align: top;"><label style="margin-right: 20px;">Buyer note</label></td>
                    <td style="width: 448px;">
                        <span>
                            <?php echo nl2br($this->escape($order_info->user_note));?>
                        </span>
                    </td>
                </tr>
            </table>
            <br>
        <?php endif;?>
    
        <p style="text-align: center; margin: 0; padding: 15px 30px; border-top: 1px solid #eeeeee;">View order detail at: <a target="_blank" href="<?php echo $campaign_url ?>"><?php echo $campaign_url ?></a></p>
        
    </div>
    <br>
    <p style="text-align: center; color: #929292;">You receive this email because you are listed as content moderator of <?php echo $page_name; ?> | <?php echo $object_name; ?>.</p>
    <p style="text-align: center; color: #929292;">YouNet Media <a target="_blank" href="http://media.younetco.com">http://media.younetco.com</a></p>
    <br>
</div>


